package ex.com.jm.food.entity;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;
/**
 * 订单实体层
 * @author zhaojw
 *
 */
@Entity
@Table(name="jm_order")
public class Order implements Serializable {

	
	private static final long serialVersionUID = 1L;
	@Id//这个订单id不用自动生成的，使用自动生成的随机数作为id
	@Column(name="order_id",nullable=false,unique=true,length=32)
	private String orderId;//订单主键
	@Column(name="pay_type",nullable=false,length=2)
	private Integer payType;//订单支付方式(0:网上支付;1:餐到付款)
	@Column(name="pay_status",nullable=false,length=2)
	private Integer payStatus;//支状付态(0:未支付;1:已支付)
	@Column(name="order_flag",nullable=false,length=2)
	private Integer orderFlage;//发货状态(0:未发货;1:已发货，2：已收货)
	@Column(name="order_startdate",length=32)
	private String orderStartdate;//配送时间时间,详细时间
	@Column(name="order_date",nullable=false,length=32)
	private  String orderDate;//下单时间
	@Column(name="order_enddate",length=32)
	private String orderEnddate;//订单完成时间。当用户点击已收货，即为完成时间
	@Column(name="user_name",nullable=false,length=32)
	private String userName;//订单人姓名
	@Column(name="user_phone",nullable=false,length=32)
	private String userPhone;//订单人联系电话
	@Column(name="user_address",nullable=false,length=32)
	private String userAddress;//订单人送餐地址([街道];[详细地址])
	@Column(name="user_remark",nullable=false,length=32)
	private String userRemark;//订单备注
	@ManyToOne
	@JoinColumn(name="att_id")
	private Attendant attId;
	@ManyToOne
	@JoinColumn(name="com_id")
	private Company comId;
	@ManyToOne
	@JoinColumn(name="user_id")
	private User userId;
	@OneToMany(mappedBy="orderId")
	private Set<OrderItem> orderItems=new HashSet<OrderItem>();
	public String getOrderId() {
		return orderId;
	}
	public void setOrderId(String orderId) {
		this.orderId = orderId;
	}
	public Integer getPayType() {
		return payType;
	}
	public void setPayType(Integer payType) {
		this.payType = payType;
	}
	public Integer getPayStatus() {
		return payStatus;
	}
	public void setPayStatus(Integer payStatus) {
		this.payStatus = payStatus;
	}
	public Integer getOrderFlage() {
		return orderFlage;
	}
	public void setOrderFlage(Integer orderFlage) {
		this.orderFlage = orderFlage;
	}
	public String getOrderStartdate() {
		return orderStartdate;
	}
	public void setOrderStartdate(String orderStartdate) {
		this.orderStartdate = orderStartdate;
	}
	public String getOrderDate() {
		return orderDate;
	}
	public void setOrderDate(String orderDate) {
		this.orderDate = orderDate;
	}
	public String getOrderEnddate() {
		return orderEnddate;
	}
	public void setOrderEnddate(String orderEnddate) {
		this.orderEnddate = orderEnddate;
	}
	public Company getComId() {
		return comId;
	}
	public void setComId(Company comId) {
		this.comId = comId;
	}
	public Set<OrderItem> getOrderItems() {
		return orderItems;
	}
	public void setOrderItems(Set<OrderItem> orderItems) {
		this.orderItems = orderItems;
	}
	public String getUserName() {
		return userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
	public String getUserPhone() {
		return userPhone;
	}
	public void setUserPhone(String userPhone) {
		this.userPhone = userPhone;
	}
	public String getUserAddress() {
		return userAddress;
	}
	public void setUserAddress(String userAddress) {
		this.userAddress = userAddress;
	}
	public String getUserRemark() {
		return userRemark;
	}
	public void setUserRemark(String userRemark) {
		this.userRemark = userRemark;
	}
	public Attendant getAttId() {
		return attId;
	}
	public void setAttId(Attendant attId) {
		this.attId = attId;
	}
	public User getUserId() {
		return userId;
	}
	public void setUserId(User userId) {
		this.userId = userId;
	}
	
}
